Click here for interactive plots:

https://kforthman.shinyapps.io/COVID19_Interactive_Plots/

Click here to see how cities and counties overlap:

https://kforthman.shinyapps.io/500citiescounties

Compare COVID stats to Neighborhood Factors

data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

Compare COVID stats to 500 cities data and Neighborhood Factors

data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

—-Linear Mixed Effects Model —-

this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling

## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
##    Data: county.Demo_and_Covid.500counties
## 
## REML criterion at convergence: -1210.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.0038 -0.3160 -0.0761  0.1681  6.3638 
## 
## Random effects:
##  Groups   Name        Variance    Std.Dev.
##  stateID  (Intercept) 0.000001791 0.001338
##  Residual             0.000012302 0.003507
## Number of obs: 178, groups:  stateID, 33
## 
## Fixed effects:
##                                  Estimate     Std. Error             df
## (Intercept)                 -0.0120719910   0.0095625180  74.3706058559
## Affluence                    0.0044865088   0.0010894740 112.0148336490
## Singletons.in.Tract          0.0007760572   0.0008806835 147.5713665474
## Seniors.in.Tract             0.0005272432   0.0011570409 154.0800380795
## African.Americans.in.Tract   0.0009235728   0.0009679062 155.2698928508
## Noncitizens.in.Tract         0.0009161526   0.0007510725 129.2794215818
## High.BP                      0.0001879746   0.0001843099 119.0807510063
## Binge.Drinking               0.0001713715   0.0001573536  48.4803949152
## Cancer                      -0.0010770574   0.0010832921 110.4315146811
## Asthma                       0.0007960025   0.0005592401  51.9302403898
## Heart.Disease                0.0015062938   0.0012874816  83.3013711538
## COPD                        -0.0002817254   0.0010712462  82.1147640089
## Smoking                     -0.0000483153   0.0002232153  88.7158291786
## Diabetes                    -0.0006457079   0.0005281133  89.0738184689
## No.Physical.Activity        -0.0000425574   0.0002029702  97.9629023771
## Obesity                      0.0002595430   0.0001735021 118.1707622825
## Poor.Sleeping.Habits        -0.0000427521   0.0001613231 129.5755276669
## Poor.Mental.Health          -0.0000795899   0.0004251413  34.6814614071
## Testing_Rate                 0.0000006823   0.0000003028  43.8073527572
## Hospitalization_Rate        -0.0000560787   0.0000881350  31.3646402187
##                            t value  Pr(>|t|)    
## (Intercept)                 -1.262    0.2107    
## Affluence                    4.118 0.0000734 ***
## Singletons.in.Tract          0.881    0.3796    
## Seniors.in.Tract             0.456    0.6493    
## African.Americans.in.Tract   0.954    0.3415    
## Noncitizens.in.Tract         1.220    0.2248    
## High.BP                      1.020    0.3099    
## Binge.Drinking               1.089    0.2815    
## Cancer                      -0.994    0.3223    
## Asthma                       1.423    0.1606    
## Heart.Disease                1.170    0.2454    
## COPD                        -0.263    0.7932    
## Smoking                     -0.216    0.8291    
## Diabetes                    -1.223    0.2247    
## No.Physical.Activity        -0.210    0.8344    
## Obesity                      1.496    0.1373    
## Poor.Sleeping.Habits        -0.265    0.7914    
## Poor.Mental.Health          -0.187    0.8526    
## Testing_Rate                 2.254    0.0293 *  
## Hospitalization_Rate        -0.636    0.5292    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of fixed effects could have been required in summary()
## 
## Correlation of Fixed Effects:
##             (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence    0.102                                                        
## Sngltns.n.T  0.028  0.069                                                 
## Snrs.n.Trct  0.545  0.384  0.195                                          
## Afrcn.Am..T  0.145  0.153 -0.403  0.144                                   
## Nnctzns.n.T -0.007  0.103  0.037  0.065 -0.085                            
## High.BP     -0.024  0.245  0.056  0.106 -0.089  0.389                     
## Bing.Drnkng -0.307 -0.177 -0.295 -0.173  0.071  0.027  0.123              
## Cancer      -0.590 -0.181  0.180 -0.316 -0.070 -0.132 -0.361 -0.094       
## Asthma      -0.398 -0.189 -0.252 -0.207  0.089  0.096  0.172  0.003  0.067
## Heart.Dises -0.155  0.084 -0.299 -0.153  0.251 -0.105 -0.001  0.059 -0.469
## COPD         0.573  0.018  0.153  0.275 -0.024  0.273  0.152  0.087 -0.279
## Smoking     -0.143  0.147 -0.173 -0.100 -0.048  0.014 -0.061 -0.298  0.078
## Diabetes     0.102 -0.354 -0.102 -0.219 -0.304 -0.312 -0.535  0.049  0.230
## N.Physcl.Ac -0.196 -0.027  0.080 -0.025 -0.032 -0.222 -0.085  0.116  0.471
## Obesity      0.003  0.415  0.434  0.304  0.135  0.189 -0.093 -0.226  0.106
## Pr.Slpng.Hb -0.445 -0.391  0.136 -0.358 -0.341 -0.032 -0.188  0.095  0.136
## Pr.Mntl.Hlt -0.354  0.269 -0.068 -0.049  0.097 -0.162 -0.051  0.084  0.330
## Testing_Rat  0.238 -0.100  0.013  0.033  0.023 -0.063 -0.045 -0.014 -0.205
## Hsptlztn_Rt -0.106 -0.243 -0.093 -0.219 -0.052 -0.088 -0.112 -0.121  0.018
##             Asthma Hrt.Ds COPD   Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence                                                                 
## Sngltns.n.T                                                               
## Snrs.n.Trct                                                               
## Afrcn.Am..T                                                               
## Nnctzns.n.T                                                               
## High.BP                                                                   
## Bing.Drnkng                                                               
## Cancer                                                                    
## Asthma                                                                    
## Heart.Dises  0.280                                                        
## COPD        -0.389 -0.563                                                 
## Smoking      0.080  0.203 -0.498                                          
## Diabetes    -0.134 -0.305 -0.071  0.226                                   
## N.Physcl.Ac  0.024 -0.371 -0.020 -0.329 -0.089                            
## Obesity     -0.267 -0.093  0.163 -0.199 -0.381 -0.061                     
## Pr.Slpng.Hb  0.076  0.252 -0.195 -0.025 -0.022 -0.105 -0.165              
## Pr.Mntl.Hlt -0.217  0.090 -0.460  0.069  0.005  0.063  0.078 -0.169       
## Testing_Rat -0.359 -0.053  0.230  0.139  0.147 -0.312  0.119 -0.140 -0.164
## Hsptlztn_Rt  0.071  0.086 -0.080  0.080  0.081 -0.064 -0.037  0.001 -0.104
##             Tstn_R
## Affluence         
## Sngltns.n.T       
## Snrs.n.Trct       
## Afrcn.Am..T       
## Nnctzns.n.T       
## High.BP           
## Bing.Drnkng       
## Cancer            
## Asthma            
## Heart.Dises       
## COPD              
## Smoking           
## Diabetes          
## N.Physcl.Ac       
## Obesity           
## Pr.Slpng.Hb       
## Pr.Mntl.Hlt       
## Testing_Rat       
## Hsptlztn_Rt  0.213
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)", data = county.Demo_and_Covid.500counties)

print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)"
##    Data: county.Demo_and_Covid.500counties
## 
## REML criterion at convergence: -2499.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6832 -0.3755 -0.0799  0.2225  7.1939 
## 
## Random effects:
##  Groups   Name        Variance    Std.Dev.
##  stateID  (Intercept) 0.000006876 0.002622
##  Residual             0.000010381 0.003222
## Number of obs: 326, groups:  stateID, 51
## 
## Fixed effects:
##                                Estimate   Std. Error           df t value
## (Intercept)                 -0.02001587   0.00733872 197.86701809  -2.727
## Affluence                    0.00269863   0.00066131 303.96272198   4.081
## Singletons.in.Tract          0.00074646   0.00061539 299.72023624   1.213
## Seniors.in.Tract             0.00051715   0.00077772 303.87838172   0.665
## African.Americans.in.Tract   0.00166186   0.00075214 306.25647171   2.210
## Noncitizens.in.Tract         0.00156578   0.00060980 276.48715410   2.568
## High.BP                     -0.00001273   0.00013652 301.28467440  -0.093
## Binge.Drinking               0.00036919   0.00014479 166.35074764   2.550
## Cancer                      -0.00040189   0.00080281 271.41128415  -0.501
## Asthma                       0.00058005   0.00048061 146.97846941   1.207
## Heart.Disease                0.00292860   0.00103331 220.12588867   2.834
## COPD                        -0.00113513   0.00078250 213.82390951  -1.451
## Smoking                     -0.00023703   0.00018039 259.10535602  -1.314
## Diabetes                    -0.00106169   0.00038619 274.55848459  -2.749
## No.Physical.Activity         0.00026626   0.00015541 244.97404079   1.713
## Obesity                      0.00021053   0.00012504 307.72297475   1.684
## Poor.Sleeping.Habits         0.00025096   0.00012068 299.06971366   2.080
## Poor.Mental.Health          -0.00009963   0.00040933 107.04048937  -0.243
##                             Pr(>|t|)    
## (Intercept)                  0.00696 ** 
## Affluence                  0.0000574 ***
## Singletons.in.Tract          0.22609    
## Seniors.in.Tract             0.50658    
## African.Americans.in.Tract   0.02788 *  
## Noncitizens.in.Tract         0.01076 *  
## High.BP                      0.92574    
## Binge.Drinking               0.01168 *  
## Cancer                       0.61706    
## Asthma                       0.22941    
## Heart.Disease                0.00502 ** 
## COPD                         0.14835    
## Smoking                      0.19002    
## Diabetes                     0.00637 ** 
## No.Physical.Activity         0.08793 .  
## Obesity                      0.09326 .  
## Poor.Sleeping.Habits         0.03842 *  
## Poor.Mental.Health           0.80815    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of fixed effects could have been required in summary()
## 
## Correlation of Fixed Effects:
##             (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence   -0.059                                                        
## Sngltns.n.T -0.052  0.041                                                 
## Snrs.n.Trct  0.387  0.293  0.073                                          
## Afrcn.Am..T  0.239  0.077 -0.404  0.203                                   
## Nnctzns.n.T -0.072  0.153  0.124  0.058 -0.193                            
## High.BP     -0.093  0.158  0.098  0.008 -0.229  0.321                     
## Bing.Drnkng -0.495 -0.033 -0.203 -0.065  0.041 -0.076  0.147              
## Cancer      -0.493 -0.094  0.231 -0.168 -0.075 -0.063 -0.331 -0.015       
## Asthma      -0.273 -0.092 -0.262 -0.124 -0.018  0.214  0.046  0.013 -0.155
## Heart.Dises -0.061  0.082 -0.303 -0.133  0.213 -0.057  0.005  0.033 -0.603
## COPD         0.479  0.003  0.132  0.169 -0.009  0.156  0.054  0.056 -0.209
## Smoking     -0.039  0.104 -0.119 -0.139 -0.104  0.158 -0.082 -0.327  0.154
## Diabetes     0.036 -0.303 -0.076 -0.131 -0.231 -0.247 -0.449  0.074  0.372
## N.Physcl.Ac -0.118  0.036  0.103  0.079  0.059 -0.275  0.004  0.131  0.332
## Obesity     -0.067  0.381  0.398  0.199  0.132  0.190 -0.103 -0.143  0.117
## Pr.Slpng.Hb -0.383 -0.346  0.161 -0.323 -0.319 -0.047 -0.157  0.087  0.027
## Pr.Mntl.Hlt -0.352  0.185 -0.010  0.030  0.055 -0.162  0.032  0.128  0.415
##             Asthma Hrt.Ds COPD   Smokng Diabts N.Ph.A Obesty Pr.S.H
## Affluence                                                          
## Sngltns.n.T                                                        
## Snrs.n.Trct                                                        
## Afrcn.Am..T                                                        
## Nnctzns.n.T                                                        
## High.BP                                                            
## Bing.Drnkng                                                        
## Cancer                                                             
## Asthma                                                             
## Heart.Dises  0.334                                                 
## COPD        -0.318 -0.495                                          
## Smoking      0.144  0.086 -0.474                                   
## Diabetes    -0.105 -0.438 -0.001  0.275                            
## N.Physcl.Ac -0.019 -0.357  0.088 -0.274 -0.168                     
## Obesity     -0.121 -0.019  0.090 -0.219 -0.374 -0.043              
## Pr.Slpng.Hb  0.001  0.238 -0.090 -0.173 -0.062 -0.151 -0.115       
## Pr.Mntl.Hlt -0.440 -0.063 -0.391 -0.031  0.069 -0.092  0.022 -0.077

Testing Rate

testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]

col.state <- rep("pink", nrow(testing.data.state))

avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)

col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"

par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")

Pink highlights the last 14 days.

day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)

twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))

par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 cases by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 cases by Date in US, log scale", 
        las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
        col = twoweek.col, border = F)

barplot(US.total$deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 deaths by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 deaths by Date in US, log scale", 
        las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
        col = twoweek.col, border = F)

barplot(US.total$rise.cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Rise in Cases of COVID-19 by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$rise.deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Rise in Deaths of COVID-19 by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)